package com.gengao.springbootcase.mapper;

import com.gengao.springbootcase.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {


    @Select("select * from dept")
    List<Dept> list();
    @Select("select * from dept where id=#{id}")
    Dept getDeptById(Integer id);

    @Delete("delete from dept where id=#{id}")
    void deleteById(Integer id);
    @Insert("INSERT INTO dept (name, create_time, update_time) " +
            "VALUES (#{name}, #{createTime}, #{updateTime})")
    void insert(Dept dept);

    @Update("UPDATE dept " +
            "SET name = #{name}, create_time = #{createTime}, update_time = #{updateTime} " +
            "WHERE id = #{id}")
    void update(Dept dept);
}
